import { useLocation } from "react-router-dom";
import { useMemo } from "react";

import TradingChartRealTime from "@/pages/trading/modules/trading-chart-realtime";

export default function HiddenPage() {
  const location = useLocation();

  const searchParams = new URLSearchParams(location.search);

  const iframeSrc = useMemo(() => {
    return (
      searchParams?.get("src") ||
      "https://cn.bing.com/search?q=%E5%91%A8%E5%88%8A%E6%8E%A8%E8%8D%90"
    );
  }, [searchParams]);

  return (
    <section className="flex flex-col h-full relative mx-[-24px]">
      <iframe className="w-full h-full" src={iframeSrc} title="Bing Search" />
      <div className="absolute bottom-20 right-20 overflow-hidden">
        <TradingChartRealTime symbol="002101" />
      </div>
    </section>
  );
}
